//============================================================================
// Name        : GSP295_Wk6_ShortestPath
// Author      : Ronald Ram
// Version     :
// Copyright   : GSP295 Wk6 Program - Shortest Path
// Description : Implementation of Shortest Path using Graph in C++
//============================================================================



#ifndef GRAPH_H_
#define GRAPH_H_

//#pragma once

#include <iostream>
#include <string>
using namespace std;



namespace GSP295_Wk6
{
	const int MAX_VERTS = 20;

	struct Vertex
	{
		string data;
		bool wasVisited;

		Vertex()
		{
			data = "NULL";
			wasVisited = false;
		}

		Vertex(string data, bool wasVisited)
		{
			this->data = data;
			this->wasVisited = wasVisited;
		}

		void Assign(string data, bool visited)
		{
			this->data = data;
			this->wasVisited = visited;
		}

		bool WasVisited()
		{
			return this->wasVisited;
		}

		void SetWasVisited(bool s)
		{
			this->wasVisited = s;
		}
	};


	struct FromToVertex
	{
		Vertex from;
		Vertex to;
		int dist;

		void Assign(Vertex from, Vertex to, int dist)
		{
			this->from = from;
			this->to = to;
			this->dist = dist;
		}

		void To(Vertex t) { this->to = t; }
		void From(Vertex f) { this->from = f; }
		void Distance(int d) { this->dist = d; }
	};


	class Graph
	{
	private:
		Vertex *vertexList;						//array of Vertices
		int **adjMatrix;						//adjacency matrix
		int size;								//number of Vertices

		void Init();							//C003: Init Method
		bool VertexExists(Vertex v);			//M008: Check if Vertex is in Graph
		int getVertexIndex(Vertex v);			//M009: Return the Index of the Vertex in the graph
		int getAdjVertex_UnVisited(int index);	//M010: return Index to next adj vertex in the graph


	public:
		Graph();								//C001: DEFAULT CONSTRUCTOR
		virtual ~Graph();						//C002: DESTRUCTOR

		void MakeEmpty();				//M001: Reset the Graph
		bool isEmpty() const;			//M002: Check if Graph is EMPTY
		bool isFull() const;			//M003: Check if Graph is FULL
		bool AddVertex(Vertex vertex);	//M004: Add a vertex to Graph
		bool AddEdge(Vertex fromVtx, Vertex toVtx, int weight);	//M005: Add an Edge w/ its weight between two Vertices
		int WeightIs(Vertex fromVertex, Vertex toVertex);		//M006: Returns the Weight Value b/w 2 Vertices
		void GetToVertices(Vertex vertex);						//M007: Returns an array of Vertices that are adjacent to vertex
		void DFS(Vertex fromVtx, Vertex toVtx);					//M011: Find the DFS Path between 2 Vertices
		void Dijkstar_sPath(Vertex fromVtx, Vertex toVtx);		//M012: Find the Shortest Path between 2 Vertices

		void Print();
	};//class
}//namespace

#endif /*GRAPH_H_*/